package Behavioral.Observer.pull;

//模拟服务端
public class Server {

    private ServerData data;

    private Client client;

    public void setClient(Client client) {
        this.client = client;
    }

    public void setData(ServerData data) {
        this.data = data;
    }

    public ServerData getData() {
        return data;
    }

    public void accept(Client client) {
        if(!client.getData().getData().equals(this.getData().getData())){
            System.out.println("客户端和服务端数据不一致");
            client.changeClentData(this.getData().getData());
        }else {
            System.out.println("客户端和服务端数据一致");
        }
    }
}
